package com.fhz.shop.ui.details;

import androidx.lifecycle.LiveData;

import com.fhz.shop.callback.ApiResponse;
import com.fhz.shop.entity.GoodsInfoLocal;
import com.fhz.shop.entity.UserCart;
import com.fhz.shop.ui.details.datasource.DetailsLocalDataSource;
import com.fhz.shop.ui.details.datasource.DetailsRemoteDataSource;

import javax.inject.Inject;

import retrofit2.http.Path;

/**
 * 时间:2023/8/29
 *
 * @author Mr.Feng
 * 简述: TODO
 */
public class DetailsRepository {
    @Inject
    DetailsLocalDataSource mDetailsLocalDataSource;
    @Inject
    DetailsRemoteDataSource mDetailsRemoteDataSource;

    @Inject
    public DetailsRepository(DetailsLocalDataSource detailsLocalDataSource, DetailsRemoteDataSource detailsRemoteDataSource) {
        mDetailsLocalDataSource = detailsLocalDataSource;
        mDetailsRemoteDataSource = detailsRemoteDataSource;
    }


    public LiveData<ApiResponse<GoodsInfoLocal>> getGoodsDetails( int id){
        return mDetailsRemoteDataSource.getGoodsDetails(id);
    }

    public LiveData<ApiResponse<UserCart>> addCart(UserCart userCart){
        return mDetailsRemoteDataSource.addCart(userCart);
    }

}
